package com.sqx.modules.health.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sqx.modules.health.entity.Hospital;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 * 医院信息 Mapper 接口
 * </p>
 *
 * @author xglhappy
 * @since 2022-04-14
 */
public interface HospitalMapper extends BaseMapper<Hospital> {

    @Select("select count(*) from health_sys_hospital where name = #{name} ")
    int filterHospital(String name);

    Integer binding(@Param("id") String id, @Param("uid") String uid, @Param("status") Integer status);

    Long getHospitalId(String hospitalName);

    Integer saveUserDevice(String id, String uid);

//    @Update("update ncg_device_watch set uid = null,status = #{status} where id = #{id}")
    @Update("update ncg_device_watch set doctorid = null,uid = null ,status = #{status} where id = #{id}")
    Integer unBinding(String id, Integer status);

    @Delete("delete from sys_user_device where uid = #{uid} and deviceid = #{id}")
    Integer delUserDevice(String id, String uid);
}
